//
//  GRError.h
//  YCGRICE
//
//  Created by Liu Feng on 2018/7/5.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^ERRORAlertBlock)(void);

@interface GRError : NSError

@property (nonatomic, assign) BOOL normalNetworkConnection;

/**
 回调，用于展示断网的情况
 */
@property (nonatomic, copy) ERRORAlertBlock alertBlock;

/**
 获取错误信息
 */
@property (nonatomic, copy, readonly) NSString *errorMsg;


/**
 错误码
 */
@property (nonatomic, copy) NSString *errorCode;


/**
 错误信息统一处理

 @param code <#code description#>
 @param userInfo <#userInfo description#>
 @return <#return value description#>
 */
- (instancetype)initWithErrorCode:(NSInteger)code userInfo:(nullable NSDictionary *)userInfo;


/**
 展示错误处理

 @param view 展示视图
 @param y 偏移量
 @param completion <#completion description#>
 */
- (void)errorAlertWithUIView:(UIView *_Nonnull)view offsetY:(CGFloat)y completion:(ERRORAlertBlock _Nonnull )completion;


@end
